package com.example.demo.store.feign;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class AccountFeignFactory implements FallbackFactory<IAccountFeign> {

    private AccountFeignFallback accountFeignFallback;
    public AccountFeignFactory(AccountFeignFallback accountFeignFallback){
        this.accountFeignFallback = accountFeignFallback;
    }

    @Override
    public IAccountFeign create(Throwable cause) {
        log.error("accountFeign请求出错:"+cause.getMessage());
        cause.printStackTrace();
        return accountFeignFallback;
    }
}
